package com.powergisol.gis.controller;

import com.powergisol.gis.service.TabSceneDrawService;
import com.powergisol.gis.util.Result;
import com.powergisol.gis.vo.TabSceneDrawVo;
import com.powergisol.gis.vo.TabUserVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.security.Principal;

@RestController
@RequestMapping(value = "sceneDraw")
@Api(description = "场景绘制", value = "场景绘制")
@AllArgsConstructor
public class TabSceneDrawController extends BaseController{
    private TabSceneDrawService tabSceneDrawService;

    @PostMapping(value = "saveSceneDraw")
    @ApiOperation(value = "保存场景绘制", notes = "保存场景绘制")
    public Result saveSceneDraw(@RequestBody TabSceneDrawVo vo, Principal p) {
        TabUserVo tabUserVo = getUser(p);
        return tabSceneDrawService.saveSceneDraw(vo, tabUserVo);
    }

    @GetMapping(value = "selectSceneDraw")
    @ApiOperation(value = "查询场景绘制", notes = "查询场景绘制")
    public Result selectSceneDraw(Integer layerId) {
        return tabSceneDrawService.selectSceneDraw(layerId);
    }

    @PostMapping(value = "updateSceneDraw")
    @ApiOperation(value = "修改场景绘制", notes = "修改场景绘制")
    public Result updateSceneDraw(@RequestBody TabSceneDrawVo sceneDrawVo) {
        return tabSceneDrawService.updateSceneDraw(sceneDrawVo);
    }
    @PostMapping(value = "deleteSceneDraw")
    @ApiOperation(value = "删除场景绘制", notes = "删除场景绘制")
    public Result deleteSceneDraw(Integer id){
        return tabSceneDrawService.deleteSceneDraw(id);
    }

}
